import request from '@/utils/request.js';


//查询用户信息
export const getUserAPI = (userId) => {
  return request({
    url: '/user/getUserInfo',
    method: 'get',
    params: { userId }
  })
}

//修改个人信息
export const updateUserAPI = (data) => {
  return request({
    url: '/user/updateUserInfo',
    method: 'post',
    data
  })
}
//修改密码
export const updatePasswordAPI = (oldPassword, newPassword,userId) => {
  return request({
    url: '/user/updatePassword',
    method: 'post',
    params: { oldPassword, newPassword,userId }
  })
}

//发送验证码
export const sendCodeAPI = (userId,email) => {
  return request({
    url: '/user/deleteCaptcha',
    method: 'get',
    params: { userId,email},
    timeout: 120000
  })
}
//删除用户
export const deleteUserAPI = (data) => {
  return request({
    url: '/user/deleteUser',
    method: 'post',
     data
  })
}

//上传头像
export const uploadAvatarAPI = (formData) => {
  return request({
    url: '/user/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
